﻿using System.Web.UI;

namespace RaceList
{
    public static class StringHelper
    {
        public static void Alert(this Page page, string Message, string Url = "")
        {
            if (string.IsNullOrEmpty(Url))
            {
                page.ClientScript.RegisterStartupScript(page.GetType(), "", "<script>alert('" + Message + "');</script>");
            }
            else
            {
                page.ClientScript.RegisterStartupScript(page.GetType(), "",
                    "<script>alert('" + Message + "');location.href='" + Url + "';</script>");
            }
        }
    }
}